wThe default mode for
opening a file with ofstream's constructor is to create it if it does
not exist, or delete everything in it if something does exist in it. The other arguments that
specify how the
file should be handled are listed below:
ios::app Opens the file, and
allows additions at the end
ios::ate Opens the file,
but allows additions anywhere
ios::trunc Deletes
everything in the file
ios::nocreate Does not open if
the file must be created
ios::noreplace Does not open if the file already exists
EXAMPLE:
w ofstream a_file("test.txt", ios::nocreate);